/**
 * Copyright &copy; 2016-2022 liuhangjun All rights reserved.
 */
package com.channelsharing.hongqu.portal.api.service.impl;

import com.channelsharing.common.cache.CacheDuration;
import com.channelsharing.common.cache.ExpireTimeConstant;
import com.channelsharing.common.service.CrudServiceImpl;
import com.channelsharing.hongqu.portal.api.dao.SecKillGoodsDao;
import com.channelsharing.hongqu.portal.api.entity.GoodsInfo;
import com.channelsharing.hongqu.portal.api.entity.SecKillGoods;
import com.channelsharing.hongqu.portal.api.service.GoodsDescriptionService;
import com.channelsharing.hongqu.portal.api.service.GoodsInfoService;
import com.channelsharing.hongqu.portal.api.service.SecKillGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.validation.constraints.NotNull;

/**
 * 商品信息接口Service
 * @author liuhangjun
 * @version 2018-06-06
 */
@CacheDuration(duration = ExpireTimeConstant.ONE_DAY)
@Service
public class SecKillGoodsServiceImpl extends CrudServiceImpl<SecKillGoodsDao, SecKillGoods> implements SecKillGoodsService {
    
    @Autowired
    private GoodsDescriptionService goodsDescriptionService;
    
    @Autowired
    private GoodsInfoService goodsInfoService;
    
    /**
     * @param id
     * @return
     */
    @Override
    public SecKillGoods findOne(Long id){
        SecKillGoods entity = new SecKillGoods();
        entity.setId(id);
        SecKillGoods secKillGoods = super.findOne(entity);
        return secKillGoods;
    }
    
    /**
     * 查询单个商品时，加上详情内容
     * @param entity
     * @return
     */
    @Override
    public SecKillGoods findOne(@NotNull SecKillGoods entity){

        SecKillGoods secKillGoods = super.findOne(entity);
        if (secKillGoods == null){
            return new SecKillGoods();
        }
        return secKillGoods;
    }
    
}
